<?php

Raise::load('core.RaiseColor');

/**
 * TestCoreRaiseColor class
 * Testing unit of 'phpraise/core/RaiseColor.php'
 *
 * @author Sam-Mauris Yong <hellclanner at live dot com>
 * @license http://www.opensource.org/licenses/bsd-license New BSD License
 * @package Raise.UnitTest.Test
 */
class TestCoreRaiseColor extends RaiseTest {

    public static function testClass(){
        self::assertClassExists('RaiseColor');
        self::assertClassExtends('RaiseColor', 'RaiseDataType');

        $c = new RaiseColor(252, 253, 254);
        self::assertObjectClass($c, 'RaiseColor');
        self::assertStrictEqual($c->red(), 252);
        self::assertStrictEqual($c->green(), 253);
        self::assertStrictEqual($c->blue(), 254);
        self::assertStrictEqual($c->alpha(), null);
        self::assertStrictEqual($c->toHex(),'fcfdfe');
        self::assertStrictEqual($c->toCssRGB(), 'rgb(252,253,254)');
        self::assertStrictEqual($c->toCssRGBA(), 'rgba(252,253,254,0)');


        $c = new RaiseColor(252, 253, 254, 50);
        self::assertObjectClass($c, 'RaiseColor');
        self::assertStrictEqual($c->red(), 252);
        self::assertStrictEqual($c->green(), 253);
        self::assertStrictEqual($c->blue(), 254);
        self::assertStrictEqual($c->alpha(), 50);
        self::assertStrictEqual($c->toHex(),'fcfdfe');
        self::assertStrictEqual($c->toCssRGB(), 'rgb(252,253,254)');
        self::assertStrictEqual($c->toCssRGBA(), 'rgba(252,253,254,0.19607843137255)');
    }

}
